﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZhiHeng.OneCard.WpfClient.Model;

namespace ZhiHeng.OneCard.WpfClient.Service
{
    public class CardData
    {
        public static TranData GetTranData(CommUtility.TranData msg)
        {
         
            return new TranData
            {
                Name = msg.Name,
                SexNo = msg.SexNo,
                DeptCode =msg.DeptCode,
                CardNo = msg.CardNo,
                AccountNo = msg.AccountNo,
                StudentCode =msg. StudentCode,
                IDCard =msg. IDCard,
                PID =msg. PID,
                CardRent=msg.DepositAmt,
                IDNo =msg. IDNo,
                Operator=msg.Operator,
                Balance =msg.Balance,
                Password =msg. Password,
                ExpireDate =msg.ExpireDate,
                SubSeq =msg. SubSeq,
                IsOpenInSys =msg. IsOpenInSys,
                TerminalNo =msg. TerminalNo,
                Flag =msg. Flag,
                GuiId=msg.GuiId,
                CardType =msg. CardType,
                AccType =msg. AccType,
                UsedCardNum =msg. UsedCardNum,
                AccAmt =msg. AccAmt,
                RetCode = msg.RetCode
            };
        }
        public static CardConsume GetCardConsume(CommUtility.TranData msg)
        {
            return new CardConsume
            {
                AccountNo = msg.AccountNo,
                CardNo = msg.CardNo,
                ConsumeType = "###",
                CardBalance = msg.Balance,
                TranAmt = msg.Balance,
                UseCardNum = msg.UsedCardNum,
                TerminalNo = 0,
                PassWord = msg.Password ,
                Operator = msg.Operator,
                Abstract = "",
                TranJnl = 0,
                BackJnl = 0,
                RetCode = CommUtility.RetCode.RET_CODE_OK
            };
        }
        public static CardAction GetCardAction(CommUtility.TranData msg)
        {
            return new CardAction
            {
                AccountNo = msg.AccountNo,
                CardNo = msg.CardNo,
                Sno= msg.StudentCode,
                QueryPWD=msg.Password,
                Operator=msg.Operator,
                RetCode = CommUtility.RetCode.RET_CODE_OK
            };
        }
    }
}
